#include<bits/stdc++.h>

using namespace std;

map<int,int>mp;

struct node
{
	int key;
	int isfirst;
	int time;
};

bool cmp(node a, node b){
	if(a.time != b.time){
		return a.time < b.time;
	}else if(a.isfirst != b.isfirst){
		return a.isfirst < b.isfirst;
	}else{
		return a.key < b.key;
	}
}

int main(){
	int n,k;scanf("%d%d", &n,&k);
	node a[2*k];
	int key[n+1];
	for (int i = 1; i < n+1; ++i)
	{
		key[i] = i;
		mp[i] = i;
	}
	int cnt = 0;
	for (int i = 0; i < k; ++i)
	{
		int w,s,c;scanf("%d%d%d", &w,&s,&c);;
		a[cnt].key = w;a[cnt+1].key = w;
		a[cnt].isfirst = 1;a[cnt+1].isfirst = 0;
		a[cnt].time =s;a[cnt+1].time = s+c;
		cnt+=2;
	}
	sort(a,a+2*k,cmp);
	for (int i = 0; i < 2*k; ++i)
	{
		// printf("time = %d\n", a[i].time);
		int index = a[i].key;
		if(a[i].isfirst){
			key[mp[index]] = 0;
		}else{
			for (int i = 1; i < n+1; ++i)
			{
				if(key[i] == 0){
					mp[index] = i;
					key[i] = index;
					break;
				}
			}
		}
	}
	for (int i = 1; i < n+1; ++i)
	{
		printf("%d%c", key[i],i == n?'\n':' ');
	}
	return 0;
}